/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

public class PostMethod extends Handler {

	private Request req;

	PostMethod(Request req) {
		this.req = req;
	}

	@Override
	public Response readFile() throws FileNotFoundException, IOException {
		
		System.out.println(req.getPathHttp());

		File f1 = new File(req.getPathHttp());

		InputStream is = new FileInputStream(f1);
		byte[] buffer = new byte[(int) f1.length()];

		is.read(buffer);
		is.close();

		Response response = new Response(req.getSoket(), buffer,
				req.getPathHttp(), req.getId(), req.getConfigBoolean());
		return response;

	}

}
